<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录页</title>
</head>
<style>
  * {
    margin: 0;
    padding: 0;
  }

  .loginBgcImg {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
  }

  .welcome {
    color: #00ccff;
    font-size: 40px;
    font-weight: 500;
    letter-spacing: 5px;
    transform: translateY(-25px);
  }

  span {
    width: 80px;
    text-align: left;
    display: inline-block;
    font-size: 20px;
  }

  input {
    border: 1px solid #ccc;
    border-radius: 10px;
    width: 200px;
    height: 30px;
    font-size: 16px;
    padding: 0 10px;
  }

  .login-input {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 70px 50px;
    border-radius: 70px;
  }

  .login-input div {
    margin-bottom: 20px;
  }

  .login-button {
    background-color: skyblue;
    width: 280px;
    height: 40px;
    cursor: pointer;
    border: 1px solid skyblue;
    border-radius: 30px;
    font-size: 16px;
    color: #000;
    margin-top: 20px;
  }
</style>

<body>
  <img class="loginBgcImg" src="./assets/xz-login3.jpg">
  <div class="box">
    <div class="login-input">
      <div class="welcome">欢迎光临</div>
      <div>
        <span>用户名:</span><input type="text">
      </div>
      <div>
        <span>密码:</span><input type="password">
      </div>
      <button class="login-button" onclick="redirectToContent()">登录</button>
    </div>
  </div>
  <script>
    function redirectToContent () {
      // 创建一个 <a> 元素
      const a = document.createElement('a')

      // 设置 href 属性
      a.href = './components/index.html'

      // 模拟点击事件
      a.click()
    }
  </script>
</body>

</html>